import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    // 侧边栏显隐
    isAside: true,
    // 列表页面
    list: {},
    detailIndex: null,
    isShowDetail: false
  },
  mutations: {
    // 按下头部的按钮隐藏或显示侧边栏
    showAside(state, isAside) {
      state.isAside = isAside;
    },
    // 保存列表模块获取的数据
    saveList(state, list) {
      state.list = list;
    },
    // 每次点击改变 详情页的index
    changeDetail(state, index) {
      state.detailIndex = index;
    },
    //隐显 详情页
    ShowDetail(state, flag) {
      state.isShowDetail = flag;
    }
  },
  actions: {}
});
